#ifndef PLAYER_H
#define PLAYER_H

#include <QStringList>
#include <string>
#include "Card.h"
#include "Hand.h"
#include "game.h"
#include "client.h"

class game;
using namespace std;

struct Bid
    {
        QString action;
        int num;
        QString suit;//S,H,C,D,NT and pass
    };
/*!
 * \brief The Player class class representing a player
 */

// class created by CP Botha
class Player
{
public :
        int id;//N =1, E=2, S=3, W=4

   Player(Hand, int,game*,Client*);//send hand and id
   //Player(GUI *,Server*,Hand, int);
   //Player(GUI *,Client*,Hand, int);

    virtual Hand getValidMoves(char);
   /*!
    * \brief getMove ask a player to return a card to play
    * \return card that needs to be played is returned
    */
   virtual void getMove(bool);  //get move from player
   /*!
    * \brief getBid ask player to return a bid
    * \return QStringList containing bidAction at index 0,trickCount at index 1 and suit at index 2
    */
   virtual void getBid();//get bid from player
   /*!
    * \brief getUsername returns player username/screen name
    * \return return string containing username/screen name
    */
   string getUsername();    //set player username
   /*!
    * \brief setUsername change player username
    * \param string containing username
    * \return true if changed successful and false if failed
    */
   bool setUsername(string);//set player username
   /*!
    * \brief getPartner returns a pointer to player partner
    * \return pointer to player partner
    */
   Player* getPartner();
   /*!
    * \brief setLocalHand set the players localHand
    * \return true if changed successful and false if failed
    */
   virtual bool setLocalHand(Hand);
   int contract;     //to store players contract
   /*!
    * \brief declarer flag set if player is declarer
    */
   bool declarer;
   /*!
    * \brief dealer flag set if player is dealer
    */
   bool dealer;
   /*!
    * \brief setHighestBid set player's highest bid up to that point
    * \param b string containing highest bid suit and trick count
    */
   void setHighestBid(string b);
   /*!
    * \brief getHighestBid returns player's highest bid up to that point
    * \return string containing highest bid suit and trick count
    */
   string getHighestBid();
   /*!
    * \brief getId returns player id
    * \return int containing player id
    */
   int getId();             //returns player id
   /*!
    * \brief sendBid send a bid made by a player
    * \param QString containing bid information
    * \param int id of player who made the bid
    */
   virtual void sendBid(QStringList,int);//send player the last bid
   /*!
    * \brief sendMove send player the last move made
    * \param Card the card that was player
    */
   virtual void sendMove(QStringList,int);//send player last card played
   void print();//print player


   /*!
    * \brief startDealing alert player that dealing is started
    */
   virtual void startDealing();
   /*!
    * \brief startRedealing alert player that redealing is started
    */
  virtual  void startRedealing();
   /*!
    * \brief startBidding alert player that bidding is started
    */
   virtual void startBidding();
   /*!
    * \brief startPlay alert player that play is started
    */
  virtual  void startPlay();

   /*!
    * \brief sendTrickWinner alert player of the trick winner
    */
   virtual void sendTrickWinner(QString);
   /*!
    * \brief sendContract send player the winning contract
    */
   virtual void sendContract(QStringList);
   /*!
    * \brief sendDummy tell the player who the dummy is
    */
   virtual void sendDummyId(int);
   /*!
    * \brief sendDummyCards send player the dummy hand
    */
   virtual void sendDummyCards(Hand);
   /*!
    * \brief sendHand alert player that hand is available
    */
   virtual void sendHand();
   /*!
    * \brief sendGameStatus send current game status to player
    * \param QStringList containing game status
    */
   virtual void sendGameStatus(QStringList);
   /*!
    * \brief startDummy start dummy phase
    */
   virtual void startDummy();
   /*!
    * \brief sendScoreUpdate send player score update
    */

   virtual void sendScoreUpdate(QString,QString,QString,QString );
   /*!
    * \brief sendGameWinner send player game winger
    * \param string containing game winner
    */
   virtual void sendGameWinner(QString);
   /*!
    * \brief hasCardsInSuit determine if player has cards of a suit
    * \param char containing suit
    * \return bool showing if player has cards in suit
    */
   bool hasCardsInSuit(char);
   /*!
    * \brief specials stores special bids, D,RD(double redouble)
    */
   string specials;
   /*!
    * \brief dummyFlag flag set true if player is dummy
    */
   bool dummyFlag;
   /*!
    * \brief localHand hand containing player cards
    */
   Hand localHand;
   /*!
    * \brief partner pointer to player partner
    */
   Player* partner;





protected:
    string username;
    Client *client;
    string position;


    game* gui;

    Hand dummyHand;
    Bid lastBid;
    string highestBid;



};

#endif // PLAYER_H
